const express = require('express');
const router = express.Router();
const systemConfigController = require('../controllers/systemConfigController');
const { isAdmin } = require('../middleware/auth');

// 获取所有系统配置 (仅管理员)
router.get('/', isAdmin, systemConfigController.getAllConfigs);

// 获取单个系统配置 (仅管理员)
router.get('/:key', isAdmin, systemConfigController.getConfigByKey);

// 更新系统配置 (仅管理员)
router.put('/:key', isAdmin, systemConfigController.updateConfig);

// 创建系统配置 (仅管理员)
router.post('/', isAdmin, systemConfigController.createConfig);

// 获取邮箱验证开关状态 (仅管理员)
router.get('/email-verification/status', isAdmin, systemConfigController.getEmailVerificationStatus);

// 切换邮箱验证开关 (仅管理员)
router.post('/email-verification/toggle', isAdmin, systemConfigController.toggleEmailVerification);

module.exports = router;